# -*- coding: utf-8 -*-
import os
#import numpy as np
import logging
#from functools import reduce
#work_path = ''
#logging.basicConfig(level=logging.INFO,
#                    format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
#                    datefmt='%a, %d %b %Y %H:%M:%S',
#                    filename=work_path+'\\factorData.log',
#                    filemode='w')
dirs = 'logs'
if not os.path.exists(dirs):
    os.makedirs(dirs)
logging.basicConfig(filename='%s/info_leetcode.log' % dirs, level=logging.INFO,
                    format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
print(logging.__file__)
logger.info('aaa')

class Solution:

    
# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, x):
#         self.val = x
#         self.next = None
    def deleteNode(self, head, node):
        """
        :type node: ListNode
        :rtype: void Do not return anything, modify node in-place instead.
        """
        node.val=node.next.val#当前值被后一个值覆盖
        node.next=node.next.next#下一节点跳到下下一节点
        
            
sss = Solution()
qqq = sss.deleteNode(head = [4,5,1,9], node = 5)  
# =============================================================================
#     # 逻辑是死循环到,最大循环次数=最下字符串长度,取出每个字符串的第n个(每次循环自加),
#     # 利用zip函数拼接,强制转化为dict,利用dict的key不能重复,判断dict的长度,确定是否每个元素的第n个值是否相等,
#     # 不等的话,返回已经存储的字符串
#     def longestCommonPrefix(self, strs):
#         n = 0
#         p = []
#         k = len(strs)
#         if k == 0:              #排除strs为空的情况
#             return ""
#         l2 = []
#         for v in strs: 
#             l2.append(len(v))   #转化为长度列表并保存
#         m = min(l2)   
#         if m == 0:              #排除单个字串为空的情况
#             return ""
#         while(True):
#             l = []
#             z = []
#             for i in range(k):
#                 l.append(strs[i][n])
#                 z.append(1)
#             l1 = zip(l,z)
#             d = dict(l1)    #转化为字典，合并相同字符
#             if(len(d) == 1):#如果字典长度为1，说明前缀相同
#                 n = n + 1
#                 p.append(l[0])
#             else:
#                 t = ''.join(p)   #连接字符
#                 return t
#             if n == m:
#                 t = ''.join(p)
#                 return t
# =============================================================================    
# =============================================================================
# 这个没理解,待定
# def getNext(s):
#     s = list(str(s))
#     temp, cnt, res = 0, 1, ""
#     # 逻辑是先把第一个值给temp,判断第二个值是不是==第一个值,相等的话+1
# # =============================================================================
# #     for num in s:
# #         if num == str(temp):
# #             cnt += 1
# #         else:
# #             if temp != -1:
# #                 res += (str(cnt) + str(temp))
# #             temp, cnt = num, 1
# #     res += (str(cnt) + str(temp))
# #     return res
# # =============================================================================
#  
# class Solution:
#     ans = ["1"]
#     def countAndSay(self, n):
#         """
#         :type n: int
#         :rtype: str
#         """
#         while len(self.ans)<n:
#             print(self.ans)
#             self.ans.append(getNext(int(self.ans[-1])))
#         return self.ans[n-1]
#         
#                             
#     pass
# sss = Solution()
# qqq = sss.countAndSay(6)  
# =============================================================================
# =============================================================================
#     def strStr(self, haystack, needle):
#         """
#         :type haystack: str
#         :type needle: str
#         :rtype: int
#         """
#         # 写的有点复杂,逻辑是 遍历haystack,遇到与needle[0]一样的,继续判断,
#         # 遍历needle,如果haystack接下来的len(needle)个元素与needle都相同,那么就相同
#         for i in range(len(haystack)):
#             if haystack[i] == needle[0]:
#                 for j in range(len(needle)):
#                     if haystack[i+j] == needle[j] and j == len(needle)-1:
#                         return i
#                     elif haystack[i+j] == needle[j]:
#                         continue
#                     else:
#                         break                   
#                 continue
#         return -1
# =============================================================================
# =============================================================================
#     def myAtoi(self, str):
#         """
#         :type str: str
#         :rtype: int
#         """
#         # 导入正则模块
#         import re
#         # 字符串中查找全部符合条件的整数，返回的是列表，第一个参数是正则，第二个参数是字符串
#         # strip()字符串去空格
#         ret = re.findall(r"^[-+]?\d+", str.strip())
#         # 判断是否有匹配的值，没有的话返回0，例如"word values 987"，匹配不到，返回0
#         if ret:
#             ret_str = ret[0]  # 匹配的数字的字符串
#             ret_str2 = ""  # 记录去符号的字符串，ret_str后面还要使用，所以定义一个新的变量记录
#             # 判断是否带有符号 + or -
#             if ret_str[0] == "-" or ret_str[0] == "+":
#                 ret_str2 = ret_str[1:]
#             else:
#                 ret_str2 = ret_str
#             # str转int
#             ret_int = int(ret_str2)
#             # 判断第一个字符是否为负号
#             if ret_str[0] == "-":
#                 # 三目运算符，判断是否溢出
#                 # 如果ret_int <= 2**31则返回-ret_int，否则返回-2**31
#                 return -ret_int if ret_int <= 2**31 else -2**31
#             else:
#                 return ret_int if ret_int < 2**31 else 2**31-1
#         else:
#             return 0
# =============================================================================
# =============================================================================
#     def firstUniqChar(self, s):
#         """
#         :type s: str
#         :rtype: int
#         """ 
#         import collections
#         dic=collections.Counter(s)#使用字典
#         for i in range(len(s)):
#             if dic[s[i]]==1:#如果字典中value为1
#                 return i
#         return -1
#         
# =============================================================================
# =============================================================================
#     def reverse(self, x):
#         """
#         :type x: int
#         :rtype: int
#         """
#         x = -120
#         l = list(str(x))
#         # 这段代码没什么意义,因为在转int的时候,自动忽略前面的0
# #        n = len(l)
# #        for i in range(n-1,0,-1):       # 判断直到遇到非0退出循环,截取到非0的位置
# #            if l[i] != '0':
# #                l = l[:i+1]
# #                break
#         if l[0] =='-':          # 遇到'-',在第0个位置插入(insert)
#                     l = l[:0:-1]
#                     l.insert(0,'-') 
#         else:
#             l = l[::-1]         # 正常没有以上逻辑,直接倒序排列
#         return int(''.join(l))  # int强制一下
# =============================================================================
# =============================================================================
#     def reverseString(self, s):
#         """
#         :type s: str
#         :rtype: str
#         """
#         a =lambda x,y:y+x
#         qwe = a(5,6)
#         result = reduce(lambda x,y:y+x,s)
#         return result
# =============================================================================
        
  


